- if @query
  - content_for :title, "Search results for '#{h(@query)}'".html_safe
- else
  - content_for :title, "Search".html_safe

.hero.search
  section.section: .container
    .columns: .column
      = render partial: "search_form"
      - unless @search
        javascript:
          document.querySelector(".hero.search input[type=text]").focus();

- if @search
  section.section.search-results: .container
    - if @projects.current_page == 1
      .columns: .column
        .level
          .level-left: .level-item: h2.subtitle.is-4 Categories

        - if current_order.default_direction?
          - if @search.categories.any?
            .columns.is-multiline
              - @search.categories.each do |category|
                .category-cards.four= category_card category
          - else
            .notification.is-default
              span.icon: i.fa.fa-info-circle
              span No matching categories were found
        - else
          .notification.is-default
            span.icon: i.fa.fa-info-circle
            span Category results are hidden when using a custom project result order

    .columns: .column.projects
      .level.project-search-nav
        .level-left: .level-item
          h2.subtitle.is-4 Projects
        .level-right
          .level-item= project_display_picker @display_mode
          .level-item
            .field.has-addons
              .control
                - if @search.show_forks
                  a.button.bugfix-forks-toggle href=link_with_preserved_display_settings(show_forks: "false")
                    span.icon: i.fa.fa-check-square
                    span Bugfix forks are <strong>shown</strong>

                - else
                  a.button.bugfix-forks-toggle href=link_with_preserved_display_settings(show_forks: "true")
                    span.icon: i.fa.fa-square-o
                    span Bugfix forks are <strong>hidden</strong>

              .control
                a.button.bugfix-forks-help href=page_path("docs/features/bugfix_forks")
                  span.icon: i.fa.fa-question-circle

          .level-item
            = project_order_dropdown current_order

      - if @projects.any?
        .columns: .column= paginate @projects

        = render "projects/listing", projects: @projects, show_categories: true, display_mode: @display_mode

        .columns: .column= paginate @projects

      - else
        .notification.is-default
          span.icon: i.fa.fa-info-circle
          span No matching projects were found
